//
//  LYWithDrawListCell.m
//  Btpin
//
//  Created by liuyan on 2019/4/15.
//  Copyright © 2019年 Vic. All rights reserved.
//

#import "LYWithDrawListCell.h"

@interface LYWithDrawListCell()

@property (nonatomic, strong) UILabel *withdrawLabel;
@property (nonatomic, strong) UILabel *timeLabel;
@property (nonatomic, strong) UILabel *stateLabel;
@property (nonatomic, strong) UILabel *accountLabel;
@property (nonatomic, strong) UILabel *arrivalLabel;
@property (nonatomic, strong) UILabel *feeLabel;

@end

@implementation LYWithDrawListCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if ([super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self initSubViews];
        self.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return self;
}

#pragma mark - InitSubViews
- (void)initSubViews{
    self.backgroundColor = [UIColor whiteColor];
    
    UIView *headview  = [[UIView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, 10)];
    headview.backgroundColor = RGB(247, 247, 247);
    [self.contentView addSubview:headview];
    
    self.stateLabel = [[UILabel alloc] initWithFrame:CGRectMake(WIDTH -70, headview.bottom, 60, 50)];
    self.stateLabel.font = [UIFont systemFontOfSize:14];
    self.stateLabel.textAlignment = NSTextAlignmentRight;
    [self.contentView addSubview:self.stateLabel];
    
    self.withdrawLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, headview.bottom+ 10, self.stateLabel.left - 20, 20)];
    self.withdrawLabel.font = [UIFont boldSystemFontOfSize:15];
    self.withdrawLabel.textColor = RGB(34, 34, 34);
    [self.contentView addSubview:self.withdrawLabel];
    
    self.timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.withdrawLabel.left, self.withdrawLabel.bottom, self.withdrawLabel.width, 15)];
    self.timeLabel.font = [UIFont systemFontOfSize:12];
    self.timeLabel.textColor = RGB(153, 153, 153);
    [self.contentView addSubview:self.timeLabel];
    
    UIView *line = [[UIView alloc] initWithFrame:CGRectMake(20, 59, WIDTH - 40, 1)];
    line.backgroundColor = RGB(247, 247, 247);
    [self.contentView addSubview:line];
    
    self.accountLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, line.bottom+ 5, WIDTH - 30, 20)];
    self.accountLabel.font = [UIFont systemFontOfSize:14];
    self.accountLabel.textColor = RGB(85, 85, 85);
    [self.contentView addSubview:self.accountLabel];
    
    self.arrivalLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, self.accountLabel.bottom, WIDTH - 30, 20)];
    self.arrivalLabel.font = [UIFont systemFontOfSize:14];
    self.arrivalLabel.textColor = RGB(85, 85, 85);
    [self.contentView addSubview:self.arrivalLabel];
    
    self.feeLabel = [[UILabel alloc] initWithFrame:CGRectMake(15, self.arrivalLabel.bottom, WIDTH - 30, 20)];
    self.feeLabel.font = [UIFont systemFontOfSize:14];
    self.feeLabel.textColor = RGB(85, 85, 85);
    [self.contentView addSubview:self.feeLabel];
}

#pragma mark -- Action
-(void)setDataDic:(NSDictionary *)dataDic{
    _withdrawLabel.text = [NSString stringWithFormat:@"提现-%@元",dataDic[@"amount"]];
    _timeLabel.text = [UIToolsControl conversionMonthDayHoursMinuteOrHoursMinute:[dataDic[@"add_time"] integerValue]];
    
    if ([dataDic[@"status"] integerValue] == 0 ) {
        _stateLabel.text = @"待处理";
        _stateLabel.textColor = [UIColor orangeColor];
    }else if ([dataDic[@"status"] integerValue] == 1){
        _stateLabel.text = @"提现成功";
        _stateLabel.textColor = [UIColor redColor];
    }else{
       _stateLabel.text = @"提现失败";
        _stateLabel.textColor = [UIColor greenColor];
    }
    
    _accountLabel.text = [NSString stringWithFormat:@"收款账号：%@(%@)",dataDic[@"payment"],dataDic[@"account"]];
    _arrivalLabel.text = [NSString stringWithFormat:@"实际到账：%@元",dataDic[@"real_amount"]];
    _feeLabel.text = [NSString stringWithFormat:@"服务费：%@元",dataDic[@"fee"]];
}

@end
